package com.powernode.oss.controller;

import com.powernode.dto.Result;
import com.powernode.oss.service.OSSService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

@RestController
@RequestMapping("/oss")
public class OSSController {
    @Autowired
    private OSSService ossService;

    /**
     * 上传文件
     **/
    @PostMapping("/upload")
    public Result upload(MultipartFile file,String dir){
        return ossService.uploadFile(file,dir);
    }

    /**
     * 删除文件
     **/
    @DeleteMapping("/remove")
    public Result remove(String filename){
        return ossService.deleteFile(filename);
    }
}
